﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HOOMT.Util;

namespace HOOMT.CodeGenerator
{
    class JavaEntityGenerator
    {

        public const string JAVA_ENTITY_PACKAGE_PATH = "E:\\Workspace8\\zfgenerator\\src\\com\\zf\\website\\entity";

        public string fileName;
        public string diagramId;

        private JavaEntityInfo entityInfo;
        private JavaEntityTemplate template;
        private JavaEntityGenerator() { }
        public JavaEntityGenerator(ObjectDiagram objD)
        {
            this.entityInfo = new JavaEntityInfo(objD);
            this.template = new JavaEntityTemplate();
            this.fileName = StringUtil.GetFirstLetterUpperCase(objD.Name) + ".java";
            this.diagramId = objD.id;

        }

        public string GenerateJavaEntity(){
            string path=JAVA_ENTITY_PACKAGE_PATH+"\\"+fileName;
            FileUtil.WriteFile(path, this.template.generate(this.entityInfo));
            return path;
        }
    }
}
